﻿@model GameCode.Models.PhoneApp.IndexModel
@{
    ViewBag.Title = "游戏特权 - 游戏推荐";
    Layout = "~/Views/Shared/_Layout.cshtml";
    //Layout = null;
}
<script type="text/javascript">
    var wrapper2;
    var wrapper2_child_count = 0;
    var wrapper2_current_scroll = 1;
    var wrapper2_interval;

    function autoScroll() {
        wrapper2_current_scroll += 1;
        if (wrapper2_current_scroll >= wrapper2_child_count) {
            wrapper2_current_scroll = 1;
        }
        wrapper2.scrollToElement('li:nth-child(' + wrapper2_current_scroll + ')', 500);
    }

    function resetWrapper2() {
        clearInterval(wrapper2_interval);
        wrapper2_child_count = 0;
        wrapper2_current_scroll = 1;
    }

    function startWrapper2() {
        resetWrapper2();

        var wrapper2_contain_width = 0;
        $("#wrapper2_contain li").each(function (index) {
            wrapper2_contain_width += $(this).outerWidth();
            wrapper2_child_count += 1;
        });
        $("#wrapper2_contain").width(wrapper2_contain_width);

        wrapper2 = new iScroll('wrapper2', {
            hScrollbar: false,
            vScrollbar: false,
            snap: 'li',
            momentum: false
        });

        wrapper2_interval = setInterval(autoScroll, 3000);
    }

    function pageStart() {
        startWrapper2();
    }

    
</script>
<!--广告-->
<div id="wrapper2">
    <div id="wrapper2_contain">
        <ul>
            @foreach (var adv in Model.AdvertiseList)
            {
                <li><a  onclick="loadUrl('PhoneApp/Advertise?id=@adv.ID')" href="#" >
                    @if (Model.DType == "IPad")
                    {
                        <img src="@string.Format("http://{0}/{1}", Request.Url.Host, adv.BigImageLink == null ? "" : adv.BigImageLink)" />
                    }
                    else
                    {
                        <img src="@string.Format("http://{0}/{1}", Request.Url.Host, adv.ImageLink == null ? "" : adv.ImageLink)" />
                    }
                </a></li>
            }
            <div class="clear">
            </div>
        </ul>
    </div>
</div>
<!--广告-->
<ul class="listview">
    <!--游戏推荐-->
    @foreach (var game in Model.GameProjectList)
    {
        <li><a onclick="loadUrl('PhoneApp/Game?id=@game.ID')" href="#"  >
            <div class="gamelist_item">
                <div class="gamelist_item_left">
                    <img class="gamelist_item_img"  src="@string.Format("http://{0}/{1}", Request.Url.Host, game.LogoLink == null ? "" : game.LogoLink)" />
                </div>
                <div class="gamelist_item_right">
                    @if (game.State == "已领取")
                    {
                        <div class="gamelist_item_status get">
                            已领取</div>
                    }
                    else
                    {
                        <div class="gamelist_item_status noget">
                            未领取</div>
                    }
                </div>
                <div class="gamelist_item_middle">
                    <h6 class="gamelist_item_name">
                        @game.GameName</h6>
                    <div class="gamelist_item_detail">
                        @game.GameDescription
                    </div>
                </div>
            </div>
            <div class="clear">
            </div>
        </a></li>
    }
    <!--游戏推荐-->
    <!--更多游戏-->
    <li><a href="#" onclick="loadUrl('PhoneApp/GameClassify')">
        <div class="gamelist_item">
            <div class="gamelist_item_more">
                更多游戏
            </div>
        </div>
    </a></li>
    <!--更多游戏-->
</ul>
<div class="clear"></div>